from pydantic_settings import BaseSettings
from functools import lru_cache

class Settings(BaseSettings):
    """
        Config class for loading environment variables.
        """
    DATABASE: str = "mysql"
    DEBUG: bool = False
    HOST: str = "localhost"
    SCHEMA: str = "mydatabase"
    USER: str = "root"
    PASSWORD: str = "root"
    SECRET_KEY: str = "xxx"
    ALGORITHM: str = "HS256"
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
    PORT: int = 3306
    REFRESH_TOKEN_EXPIRE_MINUTES: int = 7 * 24 * 60
    MAILUSERNAME: str
    MAILPASSWORD: str
    MAILFROM: str

    class Config:
        env_file = ".env"


@lru_cache
def get_settings():
    return Settings()


config = get_settings()